import json
from datetime import datetime

datas = {
    'i':1,
    'f':1.1,
    's':'aaa',
    'd':{'name':'aaaa'},
    'l':[1,2,3],
    'n':None,
    'b':(1,2,3),
    'c':{1,2,3},
    'now': datetime.now(),
}
class SetEncoder(json.JSONEncoder):
    def default(self, obj):
        if isinstance(obj, set):
            return list(obj)
        if isinstance(obj, datetime):
            return obj.strftime('%Y-%m-%d %H:%M:%S')
json_str = json.dumps(datas, cls=SetEncoder)
print(json_str)

print(json.dumps({'name': '小明'}, ensure_ascii=False))